import{C as T}from"./CodeBlock-BSWXsm4g.js";import{d as _,l as k,M as B,C as K,a as g,o as q,b as w,w as l,q as m,ag as R,t as S,f as x,e as p,r as E}from"./index-c80Lh_is.js";import{t as F}from"./toYaml-sPaYOD3i.js";const V=_({__name:"ResourceCodeBlock",props:{resource:{},codeMaxHeight:{default:void 0},isSearchable:{type:Boolean,default:!1},query:{default:""},isFilterMode:{type:Boolean,default:!1},isRegExpMode:{type:Boolean,default:!1}},emits:["query-change","filter-mode-change","reg-exp-mode-change"],setup(h,{emit:b}){const{t:i}=k(),t=h,c=b,C=B(()=>f(t.resource)),u=K(()=>{});let d=new Promise((a,e)=>{u.value=n=>n(a,e)});const v=async a=>{let e;try{e=await d}finally{d=new Promise((n,s)=>{u.value=r=>r(n,s)})}return e};async function M(){return f(await v())}function f(a){const{creationTime:e,modificationTime:n,...s}=a;return F(s)}return(a,e)=>{const n=g("KTooltip"),s=g("KToggle");return q(),w(s,{toggled:!1},{default:l(({isToggled:r,toggle:y})=>[p(T,{language:"yaml",code:C.value,"is-searchable":t.isSearchable,"code-max-height":t.codeMaxHeight,query:t.query,"is-filter-mode":t.isFilterMode,"is-reg-exp-mode":t.isRegExpMode,onQueryChange:e[0]||(e[0]=o=>c("query-change",o)),onFilterModeChange:e[1]||(e[1]=o=>c("filter-mode-change",o)),onRegExpModeChange:e[2]||(e[2]=o=>c("reg-exp-mode-change",o))},{"secondary-actions":l(()=>[p(n,{class:"kubernetes-copy-button-tooltip",text:m(i)("common.copyKubernetesText"),placement:"bottomEnd","max-width":"200"},{default:l(()=>[p(R,{class:"kubernetes-copy-button","get-text":M,"copy-text":m(i)("common.copyKubernetesText"),"has-border":"","hide-title":"","icon-color":"currentColor",onClick:()=>{r.value===!1&&y()}},{default:l(()=>[x(S(m(i)("common.copyKubernetesShortText")),1)]),_:2},1032,["copy-text","onClick"])]),_:2},1032,["text"])]),_:2},1032,["code","is-searchable","code-max-height","query","is-filter-mode","is-reg-exp-mode"]),x(),E(a.$slots,"default",{copy:o=>{r.value!==!1&&y(),u.value(o)},copying:r.value})]),_:3})}}});export{V as _};
